From 049ad7d34ef8b54b1fea42d50d235b1c0608de70 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 3 Feb 2010 09:38:57 +0000 Subject: [PATCH] libxc: Export do_mca hypercall to user space tools. This is mainly for software trigger MCE operation, so that test suites can trigger software MCE. Signed-off-by: Jiang, Yunhong --- tools/libxc/xc_misc.c | 21 +++++++++++++++++++++ tools/libxc/xenctrl.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c index 04da3d2a3f..317cfe1c16 100644 --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -96,6 +96,27 @@ int xc_sched_id(int xc_handle, return 0; } +#if defined(__i386__) || defined(__x86_64__) +int xc_mca_op(int xc_handle, struct xen_mc *mc) +{ + int ret = 0; + DECLARE_HYPERCALL; + + mc->interface_version = XEN_MCA_INTERFACE_VERSION; + if ( lock_pages(mc, sizeof(mc)) ) + { + PERROR("Could not lock xen_mc memory\n"); + return -EINVAL; + } + + hypercall.op = __HYPERVISOR_mca; + hypercall.arg[0] = (unsigned long)mc; + ret = do_xen_hypercall(xc_handle, &hypercall); + unlock_pages(mc, sizeof(mc)); + return ret; +} +#endif + int xc_perfc_control(int xc_handle, uint32_t opcode, xc_perfc_desc_t *desc, diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 79c1fd4703..ca6b89c09e 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -37,6 +37,7 @@ #if defined(__i386__) || defined(__x86_64__) #include #include +#include #endif #ifdef __ia64__ @@ -1207,6 +1208,7 @@ int xc_cpuid_apply_policy(int xc, domid_t domid); void xc_cpuid_to_str(const unsigned int *regs, char **strs); +int xc_mca_op(int xc_handle, struct xen_mc *mc); #endif struct xc_px_val { -- 2.30.2